var fs = require("fs");
const prettier = require("prettier");

var merchantConfig = require("../merchants/merchant.node");

var projectConfig = require("../manifest.json");

projectConfig["mp-weixin"].appid = merchantConfig.appid;

var jsonstr = JSON.stringify(projectConfig);

var jsonFormat = prettier.format(jsonstr, { tabWidth: 4, printWidth: 200, parser: "json" });

fs.writeFile("../manifest.json", jsonFormat, "utf8", (err) => {
    if (err) {
        console.error(err);
    } else {
        console.log("----------修改manifest.json成功-------------");
    }
});
